home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / overview / dtscpluslibrary / sources / keymaptest.cp < prev    next >
Encoding:
Text File  |  2000-06-23  |  1.7 KB  |  58 lines

  1. /*
  2.     File:        KeyMapTest.cp
  3.  
  4.     Contains:    TKeyMap is a KeyMap utility class.
  5.                   TKeyMapTest.cp contains the test functions for the TKeyMap class.
  6.  
  7.     Written by: Kent Sandvik    
  8.  
  9.     Copyright:    Copyright © 1992-1999 by Apple Computer, Inc., All Rights Reserved.
  10.  
  11.                 You may incorporate this Apple sample source code into your program(s) without
  12.                 restriction. This Apple sample source code has been provided "AS IS" and the
  13.                 responsibility for its operation is yours. You are not permitted to redistribute
  14.                 this Apple sample source code as "Apple sample source code" after having made
  15.                 changes. If you're going to re-distribute the source, we require that you make
  16.                 it clear in the source that the code was descended from Apple sample source
  17.                 code, but that you've made changes.
  18.  
  19.     Change History (most recent first):
  20.                 8/18/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  21.                 
  22.  
  23. */
  24. #ifndef _KEYMAP_
  25. #include "KeyMap.h"
  26. #endif
  27.  
  28. // This test will scan continously for key strokes, and print them
  29. // out on the screen. Terminate this with command-. (MPW tool or another
  30. // more decent environment).
  31.  
  32. void main(void)
  33. {
  34.     TKeyMap myKeyMap;
  35.  
  36.     // OK, run forever
  37.     for (;;)
  38.     {
  39.         if (myKeyMap.OptionKeyDown())
  40.             cout << "Option Key is down\n";
  41.         if (myKeyMap.CommandKeyDown())
  42.             cout << "Command Key is down\n";
  43.         if (myKeyMap.ShiftKeyDown())
  44.             cout << "Shift Key is down\n";
  45.         if (myKeyMap.IsKeyDown(0x31))            // 0x31 = space bar
  46.             cout << "Space Bar is down\n";
  47.     }
  48. }
  49.  
  50.  
  51. // _________________________________________________________________________________________________________ //
  52.  
  53.  
  54. /*    Change History (most recent last):
  55.   No        Init.    Date        Comment
  56.   1            khs        9/20/92        New file
  57. */
  58.